package com.wwj.core.wawa.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wwj.core.wawa.entity.Message;
import com.wwj.core.wawa.entity.mapper.MessageMapper;
import com.wwj.core.wawa.service.IMessageService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

/**
 * Created by Administrator on 2017/11/3.
 */
@Service
public class MessageServiceImpl implements IMessageService {

    @Resource
    private MessageMapper messageMapper;

    @Override
    public Page<Message> findByPage(int offset, int limit) {
        PageHelper.offsetPage(offset, limit);
        return (Page<Message>)messageMapper.selectMessages();
    }

    @Override
    public Page<Map<String, Object>> findPlayerMessagesByPage(int playerId, int offset, int limit) {
        PageHelper.offsetPage(offset, limit);
        return messageMapper.selectMessagesByPlayerId(playerId);
    }
}
